package graphicUserInterface.elements;

import java.awt.Color;
import java.awt.Point;

import javax.swing.JPanel;

public class TrackingPanel extends JPanel implements PositionListener {


	
	/**
	 * 
	 */
	private static final long serialVersionUID = 4741941883759350176L;
	
	/* *********************************************************
	 * Attributes
	 * ********************************************************* */

	private JPanel _TrackerSquare;

	
	public TrackingPanel(Color theColor){
    
    this.setSize(640,480);

    
    _TrackerSquare = new JPanel();
    _TrackerSquare.setBackground(theColor);
    _TrackerSquare.setSize(35, 35);
    
    addTrackerSquare();
	}
   
    
	private void addTrackerSquare(){
		this.add(_TrackerSquare);
		this.validate();
	}
		
	public void setTrackingPosition(int x, int y){
		_TrackerSquare.setLocation(x, y);
		this.validate();
	}
	public void setTrackingPosition(Point p){
		_TrackerSquare.setLocation(p);
		this.validate();
	}


	@Override
	public void update(Point p) {
		setTrackingPosition(p);		
	}
}
